
Unicode true
Name "members48"
OutFile "members48_installer.exe"
InstallDir "$PROGRAMFILES\members48"
RequestExecutionLevel admin

!define MUI_ICON "members48\m48_logo.ico"
!include MUI2.nsh
!include LogicLib.nsh
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\members48.exe"
!define MUI_FINISHPAGE_RUN_CHECKED
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

Section "Main Program" SEC_MAIN
    SetOutPath $INSTDIR
    File /r "members48\*.*"
    WriteUninstaller "$INSTDIR\Uninstall.exe"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\members48" "DisplayName" "members48"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\members48" "UninstallString" '"$INSTDIR\Uninstall.exe"'
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\members48" "QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S'
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\members48" "NoModify" 1
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\members48" "NoRepair" 1
SectionEnd

Section "Desktop Shortcut" SEC_DESKTOP
    CreateShortCut "$DESKTOP\members48.lnk" "$INSTDIR\members48.exe" "" "$INSTDIR\m48_logo.ico"
SectionEnd

Section "Start Menu Shortcut" SEC_STARTMENU
    CreateShortCut "$SMPROGRAMS\members48.lnk" "$INSTDIR\members48.exe" "" "$INSTDIR\m48_logo.ico"
SectionEnd

Section "Uninstall"
    RMDir /r "$INSTDIR"
    Delete "$DESKTOP\members48.lnk"
    Delete "$SMPROGRAMS\members48.lnk"
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\members48"
    ${If} ${FileExists} "$LOCALAPPDATA\members48"
        RMDir /r "$LOCALAPPDATA\members48"
    ${EndIf}
    ${If} ${FileExists} "$APPDATA\members48"
        RMDir /r "$APPDATA\members48"
    ${EndIf}
SectionEnd

Function .onInit
    SectionSetFlags ${SEC_DESKTOP} 1
FunctionEnd
